﻿using System.Data;
using ContractManagementSystem.DataAccess;
using ContractManagementSystem.Entity;
namespace ContractManagementSystem.BusinessLogic
{
    public static class ContractTypeBusiness
    {

        public static string ErrorMessage { get; set; }
        private static ContractTypeDataAccess _contractTypeDataAccess;

        public static DataTable FetchAll()
        {
            _contractTypeDataAccess = new ContractTypeDataAccess();
            if (_contractTypeDataAccess.FetchAll() == null)
            {
                ErrorMessage = _contractTypeDataAccess.ErrorMessage;
            }
            return _contractTypeDataAccess.FetchAll();
        }

        public static bool Insert(ContractTypeEntity contractType)
        {
            _contractTypeDataAccess = new ContractTypeDataAccess();
            if (_contractTypeDataAccess.Insert(contractType)==1)
            {
                return true;
            }
            ErrorMessage = _contractTypeDataAccess.ErrorMessage;
            return false;
        }
    }
}
